Objects Reference

face::ray_intersect

Prototype

int ray_intersect(vector& ro,vector& rd,vector& ip,float& dist,float rad=0.0f)

Parameters

Parameter Type Description
ro vector& ray origin
rd vector& ray direction
ip vector& intersection point
dist float& intersection distance
rad float intersection radius

Return Value

Returns TRUE if an intersection is found, FALSE if no intersection is found.

Remarks

This function computes the intersection with the face. 
If an intersection is found, ip will be set to the intersection point, dist will be set to the distance from the ray origin (ro) to the indersection point (ip). 
If rd is normalized, the dist value will be in scene units, if not, if will be the distance divided by the ray direction (rd) length.
The rad parameter sets the collision radius. If >0, the collision will be tested for a sphere with radius rad.